import * as types from '@/store/mutation-types';
import sendgetOrderStatis from '@/request/Order';
// import { get } from '@/common/utils';
// import router from '@/router';

export default {

  async getOrderStatis({ commit }, { start, end }) {
    commit(types.SHOW_LOADING);
    try {
      // eslint-disable-next-line
      const result = await sendgetOrderStatis({ start, end }); // 发送请求
      // console.log('getOrderStatis==>', result.list);
      commit(types.SAVE_STATIS_DATA, result.list); //! 放入到vuex

      //
    } catch (error) {
      commit(types.SHOW_ALERT, { message: error.message });// 原来log出起来的500，经过包装就是CustomError的新对象
    } finally {
      commit(types.HIDE_LOADING);
    }
  },

};
